$:.unshift File.join(File.dirname(__FILE__),"..","lib")

require "test/unit"
require "filter_generator.rb"
require "create_tree.rb"
class FilterGeneratorTest < Test::Unit::TestCase
  
  def setup
    @configFile = "../lib/foldersToBeKept.txt"
    if !File.exists?(@configFile)
      File.new(@configFile)
    end
  end
  
  def test_generateFilter
    testLine = "/Users/twer/Documents/Aptana Studio/FileDeleter/topdir/a2"
    testLine2 = "/Users/twer/Documents/Aptana Studio/FileDeleter/topdir/a3"
    
    file = File.open(@configFile,"w")
    file.puts(testLine)
    file.puts(testLine2)
    file.close
    
    filter = FilterGenerator.new(@configFile)
    assert_equal(testLine,filter.foldersToBeKept[0])
    assert_equal(testLine2,filter.foldersToBeKept[1])
    assert_equal(2,filter.foldersToBeKept.size)
  end
  
  def teardown
    File.open(@configFile,"w"){}
  end
end